﻿/*----------------------------------------------------------------
//  <copyright file="ISmsVerifyCodeService.cs" company="MicroCloud@151504200868">
//      Copyright © 2020-2024 MicroCloud Corporation, All rights reserved.
//  </copyright>
//  <site>https://gitee.com/chenmm123/microclouds</site>
//  <last-editor>cmm</last-editor>
//  <last-date>2023-09-14 11:26</last-date>
//----------------------------------------------------------------*/

namespace MicroCloud.SMS
{
    #region "业务契约：短信验证码服务"
    /// <summary>
    /// 业务契约：短信验证码服务
    /// </summary>
    public interface ISmsVerifyCodeService
    {
        #region "同步方法"
        #region "发送验证码短信"
        /// <summary>
        /// 发送验证码短信
        /// </summary>
        /// <param name="codeLength">验证码长度</param>
        /// <param name="codeType">验证码类型</param>
        /// <param name="requestIp">请求ID</param>
        /// <param name="phoneNumber">接收短信的手机号码</param>
        /// <returns>业务操作结果</returns>
        OperationResult Send(int codeLength, ValidateCodeType codeType, string requestIp, string phoneNumber);
        #endregion
        #region "校验短信验证码有效性"
        /// <summary>
        /// 校验短信验证码有效性
        /// </summary>
        /// <param name="dto">短信验证码DTO</param>
        /// <param name="confirmIfSuccess">验证成功时是否确认</param>
        /// <returns></returns>
        OperationResult Check(VerifyCodeCheckDto dto, bool confirmIfSuccess = true);
        #endregion

        #endregion

        #region "异步方法"
        #region "发送验证码短信"
        /// <summary>
        /// 发送验证码短信
        /// </summary>
        /// <param name="codeLength">验证码长度</param>
        /// <param name="codeType">验证码类型</param>
        /// <param name="requestIp">请求ID</param>
        /// <param name="phoneNumber">接收短信的手机号码</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> SendAsync(int codeLength, ValidateCodeType codeType, string requestIp, string phoneNumber);
        #endregion
        #region "校验短信验证码有效性"
        /// <summary>
        /// 校验短信验证码有效性
        /// </summary>
        /// <param name="dto">短信验证码DTO</param>
        /// <param name="confirmIfSuccess">验证成功时是否确认</param>
        /// <returns></returns>
        Task<OperationResult> CheckAsync(VerifyCodeCheckDto dto, bool confirmIfSuccess = true);
        #endregion

        #endregion

    }
    #endregion

}
